/**
 * <pre>
 * Title: 		MagTopicMsgListener.java
 * Author:		linriqing
 * Create:	 	2012-2-29 下午07:50:05
 * Copyright: 	Copyright (c) 2012
 * Company:		Shenzhen Helper
 * <pre>
 */
package test;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.ObjectMessage;

import com.hengpeng.common.util.ObjectHelper;

/**
 * <pre>
 * 消息主题监听器实现
 * </pre>
 * @author linriqing
 * @version 1.0, 2012-2-29
 */
public class MagTopicMsgListener implements MessageListener
{
	@Override
	public void onMessage(Message arg0)
	{
		if (arg0 instanceof ObjectMessage)
		{
			ObjectMessage message = (ObjectMessage) arg0;
			try
			{
				System.out.println("收到消息：" + ObjectHelper.toPropertiesString(message.getObject()));
			}
			catch (JMSException e)
			{
				e.printStackTrace();
			}
		}
		else
		{
			System.out.println("收到消息：" + ObjectHelper.toPropertiesString(arg0));
		}
	}
}
